import '../../utils/user.dart';

class BoardEntity {
  int? roomId;
  double? totalGold;
  String? userAvatar;
  String? userId;
  String? userName;

  BoardEntity(
      {this.roomId,
        this.totalGold,
        this.userAvatar,
        this.userId,
        this.userName});

  BoardEntity.fromJson(Map<String, dynamic> json) {
    roomId = json['roomId'];
    totalGold = json['totalGold'];
    userAvatar = json['userAvatar'];
    userId = json['userId'];
    userName = json['userName'];
  }

  BoardEntity.fromUser() {
    userAvatar = User.info?.avatar;
    userId = User.info?.id;
    userName = User.info?.name;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['roomId'] = this.roomId;
    data['totalGold'] = this.totalGold;
    data['userAvatar'] = this.userAvatar;
    data['userId'] = this.userId;
    data['userName'] = this.userName;
    return data;
  }
}